package com.frxuexi.park2304.notice

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.NoticeBeanItem
import com.frxuexi.park2304.R
import com.frxuexi.park2304.databinding.ItemNotice2Binding
import com.frxuexi.park2304.databinding.ItemNoticeBinding

class NoticeAdapter2:BaseMultiItemQuickAdapter<NoticeBeanItem,BaseViewHolder>(){

    init {
        addItemType(0,R.layout.item_notice)
        addItemType(1,R.layout.item_notice2)
    }

    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemNoticeBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: NoticeBeanItem) {
        if(item.myType==0) {
            val binding = DataBindingUtil.getBinding<ItemNoticeBinding>(helper.itemView)!!
            binding.bean = item
        }else{
            val binding = DataBindingUtil.getBinding<ItemNotice2Binding>(helper.itemView)!!
            binding.bean = item
        }

    }
}